package com.cnd.scm.orm.repositoryproxy;

import com.cnd.scm.orm.PhoenixRepository;

import javax.sql.DataSource;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

/**
 * @version V1.0
 * @ClassName: PhoenixRepositoryProxy
 * @Description:
 * @author: 李启联
 * @date: 2020-05-29 11:23
 * @Copyright: Copyright (c), 2020
 */
public class PhoenixRepositoryProxy<T> implements InvocationHandler {
    //被代理的接口Class对象
    private Class<T> interfaceClass;

    public PhoenixRepositoryProxy(Class<T> interfaceClass) {
        this.interfaceClass = interfaceClass;

    }

    @Override
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
        DataSource dataSource;
        return method.invoke(new PhoenixRepository(interfaceClass), args);
    }


}